//
//  SYHomeTitleButton.swift
//  SingWeibo
//
//  Created by shiying on 15/12/20.
//  Copyright © 2015年 shiying. All rights reserved.
//

import UIKit

class SYHomeTitleButton: UIButton {

    init(title: String) {
        super.init(frame: CGRectZero)
        // 设置title
        setTitle(title, forState: UIControlState.Normal)
        
        // 设置图片
        setImage(UIImage(named: "navigationbar_arrow_down"), forState: UIControlState.Normal)
        
        // 设置字体颜色
        setTitleColor(UIColor.blackColor(), forState: UIControlState.Normal)
        
        sizeToFit()
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        self.titleLabel?.frame.origin.x = 0
        self.imageView?.frame.origin.x = titleLabel!.frame.size.width + 5
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

}
